//
//  XNoDataView.m
//  ReceiveVouchers
//
//  Created by Veer on 2017/7/20.
//  Copyright © 2017年 ReceiveVouchers. All rights reserved.
//

#import "XNoDataView.h"


@interface XNoDataView()

@property (nonatomic, weak) UILabel *tipLbl;
@property (nonatomic, weak) UILabel *titleLabel;

@end

@implementation XNoDataView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupSubView];
    }
    return self;
}


- (void)setupSubView
{
    
    // 图片
    UIImageView *imgView = [[UIImageView alloc] init];
    imgView.contentMode = UIViewContentModeScaleAspectFit;
    imgView.image = [UIImage imageNamed:@"nodataBg2"];
    [self addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(0);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(100);
    }];
    
    // 文字
    UILabel *tipLbl = [[UILabel alloc] init];
    tipLbl.font = VRFont(16);
    tipLbl.textAlignment = NSTextAlignmentCenter;
    tipLbl.textColor = [UIColor grayColor];
    [self addSubview:tipLbl];
    self.tipLbl = tipLbl;
    [tipLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(imgView.mas_bottom).offset(30);
    }];
    
    // 文字
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = [UIFont boldSystemFontOfSize:19];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor blackColor];
    [self addSubview:titleLabel];
    self.titleLabel = titleLabel;
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(tipLbl.mas_bottom).offset(46);
    }];
}


#pragma mark - setter && getter
- (void)setShowText:(NSString *)showText
{
    _showText = showText;
    
    self.tipLbl.text = showText;
}

-(void)setShowTitleText:(NSString *)showTitleText{
    _showTitleText = showTitleText;
    self.titleLabel.text = showTitleText;

}

@end
